// 正确区分消息来源
function handleIncomingMessage(msg) {
    // 收到的对方消息
    const receivedMsg = '早上好';  // 实际应从消息队列获取
    addToChatHistory({
        type: 'received',
        content: receivedMsg  // 保持原始接收内容不变
    });

    // AI生成回复
    const aiResponse = generateResponse(msg);
    addToChatHistory({
        type: 'sent',
        content: aiResponse  // AI回复单独处理
    });
} 